-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Androapp 5497 mobile UI implement image block #81
Androapp 5497 mobile UI implement image block #81
Conversation
@Composable | ||
fun ImageBlockScreen() { | ||
ImageBlock( | ||
file = File("/data/data/org.hisp.dhis.android/files/sample.jpg"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can add a sample image jpg in the commons
module and then use it here to test the component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a packaged resource. We can add an option to pick a file from the device storage in the catalog app? Since that's will be actual use case no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, but this would made us handling permissions right?. I mean mean while is in commons and not in desigsystem module both solutions will look good for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but we would be handling packaged resource and this block expects a file path. I don't think that would work, no? The other approach we were discussing is to create a Painter
and we can pass any painter like painterResource
or painterFile
(we create the painter file).
With that we can pass painterResource
in catalog app and use painterFile
in production if that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andresmr @msasikanth I have update the Image Block to make it more generic, now we can pass the type of resource we want to load such as ImageBitmap, Painter, etc. And painter parameter to define how to paint it.
For Loading Image from Local Storage
ImageBlock( load = { loadImageBitmap() }, painterFor = { remember { BitmapPainter(it!!) } }, onClick = {}, )
For Loading Image from Resource
ImageBlock( load = { painterResource("drawable/sample.png") }, painterFor = { remember { it } }, onClick = {}, )
8e30520
to
c18ff6f
Compare
8c295d7
to
838df9a
Compare
838df9a
to
88ad368
Compare
88ad368
to
748ac45
Compare
No description provided.